import request from '@/utils/request'

function formatRequestUri(name) {
  return 'flow/node/' + name
}

export function Gets(flowId) {
  return request({
    url: formatRequestUri('Gets'),
    method: 'get',
    params: {
      flowId
    }
  })
}

export function SetCoordinate(id, data) {
  return request({
    url: formatRequestUri('SetCoordinate'),
    method: 'post',
    data: {
      Id: id,
      Value: data
    }
  })
}
export function Add(data) {
  return request({
    url: formatRequestUri('Add'),
    method: 'post',
    data
  })
}

export function Delete(id) {
  return request({
    url: formatRequestUri('Delete'),
    method: 'get',
    params: {
      id
    }
  })
}

export function Get(id) {
  return request({
    url: formatRequestUri('Get'),
    method: 'get',
    params: {
      id
    }
  })
}

export function Set(id, data) {
  return request({
    url: formatRequestUri('Set'),
    method: 'post',
    data: {
      Id: id,
      Value: data
    }
  })
}

export function SetForm(id, data) {
  return request({
    url: formatRequestUri('SetForm'),
    method: 'post',
    data: {
      Id: id,
      Value: data
    }
  })
}
export function SetBeginNode(id, data) {
  return request({
    url: formatRequestUri('SetBeginNode'),
    method: 'post',
    data: {
      Id: id,
      Value: data
    }
  })
}

export function SetIntoOut(id, data) {
  return request({
    url: formatRequestUri('SetIntoOut'),
    method: 'post',
    data: {
      Id: id,
      Value: data
    }
  })
}
